﻿using System;
using PortalCurriculo.Domain;

namespace PortalCurriculo.MvcWebUI.Helpers
{
    public class LoggedHelper
    {
        public static bool IsSameProfessional(int? currentId = null)
        {
            var profissional = Session.ContextSession<Profissional>(Session.SessionName.ProfissionalLogado);

            if (profissional == null) return false;

            if (currentId == null)
            {
                var queryString = System.Web.HttpContext.Current.Request.QueryString["idProfissional"];

                if (string.IsNullOrEmpty(queryString)) return false;

                currentId = int.Parse(queryString);
            }

            return profissional.Id == currentId;
        }
    }
}